package com.app.TCES.service;

import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.app.TCES.domain.Class_Course;
import com.app.TCES.domain.Department;
import com.app.TCES.domain.ST_indicators;
import com.app.TCES.domain.TT_indicators;
import com.app.TCES.domain.Teacher_Course;
import com.app.TCES.domain.Test;
import com.app.TCES.mapper.Teacher_Mapper;

@Service
public class Teacher_Service {

	Logger log = LogManager.getLogger(Teacher_Service.class);

	@Autowired
	Teacher_Mapper teacher_Mapper;

	// 查找课程及上课班级
	public List<Class_Course> selectT_Courses(Object object) {
		return teacher_Mapper.selectT_CourseBy_tchId(object);
	}

	// 查找教师所在院系的所有教师
	public List<Teacher_Course> selectTeacher_All(Object object) {
		// 通过教师ID查找院系
		Department d = teacher_Mapper.selectDept(object);

		// 通过院系查找同院系的所有教师(除当前ID)
		List<Teacher_Course> list = teacher_Mapper.selectTeacherBy_deptId(d.getDeptId(), object);
		return list;

	}

	// 获取教师同行评价问题内容
	public List<Test> selectTeacherTest() {
		return teacher_Mapper.selectTeacherTest();
	}

	// 教师同行评分
	public void insertTT(int teacherId, Object object, double score) {
		teacher_Mapper.insertTT(teacherId, object, score);

	}

	// 同过教师查找已评价过的同行(条件:tchId)
	public List<TT_indicators> selectIndicators(Object object) {
		return teacher_Mapper.selectIndicators(object);
	}

	// 当前tchId的分数(学生)
	public double getScore_Student(Object object) {

		return teacher_Mapper.selectScores_S(object);
	}

	// 当前tchId的分数(教师)
	public double getScore_Teacher(Object object) {

		return teacher_Mapper.selectScores_T(object);
	}

	// 获取所有教师的分数(学生)
	public List<ST_indicators> getScoreAll_student() {
		return teacher_Mapper.selectST_score_avg();
	}

	// 获取平均分大于80的教师总数(学生)
	public int getSATotal() {
		return teacher_Mapper.SA();
	}

	// 获取平均分大于60小于80的教师总数(学生)
	public int getSBTotal() {
		return teacher_Mapper.SB();
	}

	// 获取平均分小于60的教师总数(学生)
	public int getSCTotal() {
		return teacher_Mapper.SC();
	}

	// 获取平均分大于80的教师总数(教师)
	public int getTATotal() {
		return teacher_Mapper.TA();
	}

	// 获取平均分大于60小于80的教师总数(教师)
	public int getTBTotal() {
		return teacher_Mapper.TB();
	}

	// 获取平均分小于60的教师总数(教师)
	public int getTCTotal() {
		return teacher_Mapper.TC();
	}

	// 获取所有教师的分数(教师)
	public List<TT_indicators> getScoreAll_Teacher() {
		List<TT_indicators> list = teacher_Mapper.selectTT_score_avg();

		return list;
	}

}
